package com.ljs.springbootinit.bizMq;

import com.ljs.springbootinit.constant.CommonConstant;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import org.aspectj.apache.bcel.classfile.Constant;

//
public class BiInitMain {
    public static void main(String[] args) {
        String QueueName=BiConstant.BI_QueueName;
        String Exchange=BiConstant.BI_EXCHANGE_NAME;
        String RoutingKey=BiConstant.BI_ROUTING_KEY;

        try {
            ConnectionFactory factory = new ConnectionFactory();
            factory.setHost("localhost");
            Connection connection = factory.newConnection();
            Channel channel = connection.createChannel();
            channel.queueDeclare(QueueName,true,false,false,null );
            channel.exchangeDeclare(BiConstant.BI_EXCHANGE_NAME,"direct");
            channel.queueBind(QueueName,Exchange,RoutingKey);
        }catch (Exception e){

        }
    }
}
